package com.blb.ishop.service;

import com.blb.ishop.dao.UserDAO;
import com.blb.ishop.entity.User;
import com.blb.ishop.util.MyLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDAO userDAO;

    @Override
    public boolean login(User user) {
        boolean rs = userDAO.login(user);
        return rs;
    }

    @MyLog("aa")
    @Override
    public void addUser(User user) {
//        int x = 10 / 0;
        userDAO.addUser(user);
    }

    @MyLog("cc")
    @Override
    public void updateUser(User user) {
        userDAO.updateUser(user);
    }

    @Override
    public void deleteUser(Long id) {
        userDAO.deleteUser(id);
    }

    @Override
    public List<User> selectUser() {
        return userDAO.selectUser();
    }
}
